<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('调整课程')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-arrange-edit" th:object="${mgrCourseArrange}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label ">教师：</label>
                <div class="col-sm-8">
                    <div class="form-control-static" th:text="${teacher}"></div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label ">课程：</label>
                <div class="col-sm-8">
                    <div class="form-control-static" th:text="${courseName}"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label ">教室：</label>
                <div class="col-sm-8">
                    <select name="roomId" class="form-control m-b">
                        <option th:each="room:${rooms}" th:value="${room.roomId}" th:text="${room.roomCode}" th:selected="${room.flag}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="courseDate" th:value="${#dates.format(mgrCourseArrange.courseDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">时间段：</label>
                <div class="col-sm-8">
                    <select name="timeSlot" class="form-control m-b" th:with="type=${@dict.getType('course_time_slot')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{timeSlot}"></option>
                    </select>
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "mgr/adjust";
        $("#form-arrange-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/exchangeCourse", $('#form-arrange-edit').serialize());
            }
        }

        $("input[name='courseDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "day",
            autoclose: true
        });
    </script>
</body>
</html>